

<script language="javascript">
	function Hello(){
		alert("Hello");
	}
 function wopen(url, name, w, h){
	  w += 32;
	  h += 96;
	  wleft = (screen.width - w) / 2;
	  wtop = (screen.height - h) / 2;
	  
	  if (wleft < 0) {
		w = screen.width;
		wleft = 0;
	  }
	  if (wtop < 0) {
		h = screen.height;
		wtop = 0;
	  }
	  var win = window.open(url,
		name,
		'width=' + w + ', height=' + h + ', ' +
		'left=' + wleft + ', top=' + wtop + ', ' +
		'location=no, menubar=no, ' +
		'status=no, toolbar=no, scrollbars=yes, resizable=no');
	  // Just in case width and height are ignored
	  win.resizeTo(w, h);
	  // Just in case left and top are ignored
	  win.moveTo(wleft, wtop);
	  win.focus();
}
function printTL(malophp){
	//alert("Hello");
	wopen('Hienthinhatki.php?malophp='+malophp,'','780','580');
}  
</script>
<?php
    include_once('Configs/database.php');
	include_once('Models/HocPhan.php');
	include_once('Configs/paging.php');
    include_once('Models/HocKiNamHoc.php');
    include_once('Models/HPMoVaoHKNH.php');
    include_once('Models/LopHocPhan.php');
    include_once('Models/Khoa.php');
	 include_once('Models/NhatKi.php');
    include_once('Models/NhatKiChiTiet.php');
    
?>
<link href="Libraries/css/jquery.datepick.css" rel="stylesheet" type="text/css"></head>
<form name="ghinhatkigiangday" method="POST">
<table align="center" class="font" width="800" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class=main_1><img border="0" src="Libraries/images/tbl_left.gif" width="10" height="25" /></td>
    <td align=center class=main_1>Xem Nhật Kí Giảng Dạy Lớp Học Phần </td>
    <td class=main_1><p align="right"><img border="0" src="Libraries/images/tbl_right.gif" width="10" height="25" /></p></td>
  </tr>
  <tr >
    <td class="border_1" colspan="3" valign="top"><table width="100%" border="0" align="center"  >
                <tr>
                    <td width="130%" >&nbsp;</td>
                </tr>
                <tr>
                  <td align="center"><table border="0">
                      <tr>
                        <td>Năm học</td>
                        <td>
							<select name="cbonamhoc" onchange="document.ghinhatkigiangday.cbohocki.selectedIndex=0;">
                          		<option value=" "></option>
                          			<?php
										$hknh = new HocKiNamHoc();
                                		$result = $hknh->dsNamHoc();
                                		while ($rows=mysql_fetch_array($result)){
                                    		echo "<option value='".$rows['namhoc']."'";				
				                    		echo ">".$rows['namhoc']."</option>";
                                		}
                                		if (isset($_POST['cbonamhoc'])){
                                    		echo "<script language=\"javascript\">for(var i=0;i<document.ghinhatkigiangday.cbonamhoc.length;i++){if(document.ghinhatkigiangday.cbonamhoc[i].value=='$namhoc'){document.ghinhatkigiangday.cbonamhoc.selectedIndex=i;break;}}</script>";
                                		}
                                	?>
                        	</select>						</td>
                        <td>Học kì</td>
                        <td>
							<select name="cbohocki"  onchange="document.ghinhatkigiangday.cbokhoa.selectedIndex=0;">
                          		<option value="0"></option>
                          		<option value="1" <?php if ($_POST['cbohocki']==1) echo "selected='selected'"; ?>>1</option>
                          		<option value="2" <?php if ($_POST['cbohocki']==2) echo "selected='selected'"; ?>>2</option>
                          		<option value="3" <?php if ($_POST['cbohocki']==3) echo "selected='selected'"; ?>>Hè</option>
                        	</select></td>
                        <td>Khoa</td>
                        <td><select name="cbokhoa" onchange="document.ghinhatkigiangday.cbobomon.selectedIndex=0;document.ghinhatkigiangday.submit();">
                          <option value=" "></option>
                          <?php
							$khoa = new Khoa();
							
							$result = $khoa->dsTatCaKhoa();
							while ($rows = mysql_fetch_array($result)){
								echo "<option value='".$rows['makhoa']."'>".$rows['tenkhoa']."</option>";
							}
                            
						?>
                        </select></td>
                        <td>Bộ môn </td>
                        <td><select name="cbobomon" onchange="document.ghinhatkigiangday.submit();">
                          <option value=" "></option>
                          <?php
							if (isset($_POST['cbokhoa'])){
							     echo "<script language=\"javascript\">for(var i=0;i<document.ghinhatkigiangday.cbokhoa.length;i++){if(document.ghinhatkigiangday.cbokhoa[i].value=='$makhoa'){document.ghinhatkigiangday.cbokhoa.selectedIndex=i;break;}}</script>";
                                $khoa = new Khoa();
                                $khoa->setMaKhoa($makhoa);
                                $result = $khoa->dsBMCuaKhoa();
		                        while ($rows = mysql_fetch_array($result)){
                                    echo "<option value='".$rows['mabm']."'>".$rows['tenbm']."</option>";
		                        }
                                
							}
						  ?>
                        </select></td>
                      </tr>
                    </table>				</td>
               </tr>
              
               <tr>
                 <td align="center">
                 <?php
                   
                    if (isset($_POST['cbokhoa']) && strlen($mabm) > 0){
                        echo "<script language=\"javascript\">for(var i=0;i<document.ghinhatkigiangday.cbobomon.length;i++){if(document.ghinhatkigiangday.cbobomon[i].value=='$mabm'){document.ghinhatkigiangday.cbobomon.selectedIndex=i;break;}}</script>";
                        $db = new database();
                        $query = "select malophp,kihieu,d.mahp,tenhp, b.maso, concat(holot, ' ', ten) as hoten ";
                        $query .= "from BoMon a, CanBoGiangDay b, CanBo c, LopHocPhan d, HocPhan e ";
                        $query .= "where namhoc='".$namhoc."' and hocki=".$hocki." and a.mabm='".$mabm."' and a.mabm = b.mabm and b.maso = c.maso and b.maso = d.maso and d.mahp = e.mahp order by d.mahp asc";
                        $db->setQuery($query);
                        $result = $db->fetchAll();
                        $i = 0;
                        $numRecord = mysql_num_rows($result);
                        
                          echo "<table width='800' border='0'>";
                           echo "<tr>";
                             echo "<td><div class='panel_cn' style=' border:1 #0099FF;'>";
                               echo "<fieldset>";
                               echo "<legend>Danh sách các lớp học phần </legend>";
                                 echo "<table width='800' class='border_1'  id='tbmain' cellpadding='0' cellspacing='0'>";
                                     echo "<tr>";
                                       echo "<td align='center' width='28' class='main_3' >STT</td>";
                                       echo "<td align='center' class='main_3' width='68'>Lớp HP</td>";
                                       echo "<td align='center' class='main_3' width='22'>Kh</td>";
                                       echo "<td align='center' class='main_3' width='63'>Mã HP</td>";
                                       echo "<td align='center' class='main_3' width='204'>Tên Học Phần</td>";
                                       echo "<td align='center' class='main_3' width='60'>MSCB </td>";
                                       echo "<td align='center' class='main_3' width='146'>Tên Cán Bộ</td>";
                                       echo "<td align='center' class='main_3' width='70'>Xem nhật kí</td>";
                                     echo "</tr>";
						 
     	                      if ($numRecord > 0){
                                    while ($rows = mysql_fetch_array($result)){
                                        $i++;
                                        $c = 2-$i%2;
                                   
                               
                                     echo "<tr>";
                                       echo "<td align='center' class='level_1_$c' >".$i."</td>";
                                       echo "<td align='center' class='level_1_$c'>".$rows['malophp']."</td>";
                                       echo "<td align='center'  class='level_1_$c'>".$rows['kihieu']."</td>";
                                       echo "<td align='center'  class='level_1_$c'>".$rows['mahp']."</td>";
                                       echo "<td align='center' class='level_1_$c'>".$rows['tenhp']."</td>";
                                       echo "<td align='center' class='level_1_$c'>".$rows['maso']."</td>";
                                       echo "<td align='center'  class='level_1_$c'>".$rows['hoten']."</td>";
                                       echo "<td align='center'  class='level_1_$c'><input type='radio' name='rdomalophp' value='".$rows['malophp']."'  onClick='printTL(this.value);'  /></td>";
                                       
                                     echo "</tr>";
									 
                                    }
									
                                
                                }
                                else{
                                     echo "<tr>";
                                       echo "<td align='center' class='level_1_$c' colspan='8'>Không có lớp học phần nào.</td>";
                                      
                                     echo "</tr>";
                                }
                               echo "</table>";
                               echo "</fieldset>";
                             echo "</div></td>";
                           echo "</tr>";
                         echo "</table> ";
                        
                        
                    }
                   
                      
                 ?>
                 </td>
               </tr>
               
                
        </table>
       
           

    </td>
  </tr>
</table>
<br />


</form>
